<?
	include_once ("../include/conn.php");
	include_once ('config.php');

	/**************************************** 
	****************更新用户资料*****************
	******************************************/


	//开始数据处理
	$openid    = $_POST['openid'];
	$unionid   = $_POST['unionid'];
	$nickName  = $_POST['nickName'];
	$avatarUrl = $_POST['avatarUrl'];
	$gender    = $_POST['gender'];
	$country   = $_POST['country'];
	$province  = $_POST['province'];
	$city      = $_POST['city'];

	$results = array('code' => 0,'msg'=>'更新用户信息成功！');//用于正常有数据输出的

	//////////////////////////// 取出用户信息 //////////////////////////
	

	$cmd = "update {$TABLE_C}user set 
	nickName = '$nickName', 
	avatarUrl = '$avatarUrl', 
	gender = '$gender', 
	country = '$country', 
	province = '$province', 
	city = '$city',
	unionid='$unionid' 
	where openid='$openid'";

	$mydb->query($cmd); #更新到数据库

	
	// //////////////////输出数据////////////////////////////////

	echo json_encode($results);

	// 结束
	mysql_close();
?>